#pragma once

#include "Common.h"
#include "ThreadCache.h"

static void* ConcurrentAlloc(size_t size)
{
	assert(size <= MAX_BYTES);

	if (pTLSThreadCache == nullptr)
	{
		pTLSThreadCache = new ThreadCache;
	}
	// std::cout << "pid:" << std::this_thread::get_id << " : " << pTLSThreadCache << std::endl;
	return pTLSThreadCache->Allocate(size);
}

static void ConcurrentFree(void* ptr, size_t size)
{
	assert(ptr);
	assert(size <= MAX_BYTES);
	assert(pTLSThreadCache);

	pTLSThreadCache->Deallocate(ptr, size);

}